<template>
  <el-select v-model="value" filterable placeholder="请选择" @change="changeValue($event)" clearable style="width:100%">
    <el-option
      v-for="item in partys"
      :key="item.code"
      :label="item.name"
      :value="item.code"
    />
  </el-select>
</template>
<script>
import request from '@/utils/request'
export default {
  data() {
    return {
      value: '',
      partys: [],
      callbackMethod: '',
      partyName: ''
    }
  },
  created() {
    this.findShipmentPartys()
  },
  methods: {
    findShipmentPartys(warehouseCode) {
      this.partys = []
      this.value = ''
      // 父节点为空时不查询，并清空数据
      if(warehouseCode != '' && warehouseCode != null) {
        request({
          url: '/arpa-basic-api/party/wmsShipment',
          method: 'get',
          params: { name: this.partyName }
        }).then(response => {
          this.partys = response.data
        })
      }
    },

    changeValue(e) {
      this.$emit("setCustomerCode", e)
    },
  }
}
</script>
